package com.ra.util;

import java.util.Calendar;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Index;

@Entity
public class SmsInfo {

	private Integer id;
	
	private String mobile;
	
	private String code;
	
	private Date createDate;
	
	private Integer enableTryCount;
	
	private Integer smsLogId;
	
	public SmsInfo() {
	}
		
	public SmsInfo(String mobile, String code, Integer smsLogId) {
		this.mobile = mobile;
		this.code = code;
		this.createDate = Calendar.getInstance().getTime();
		this.enableTryCount = 10;		// try 10 times at most
		this.smsLogId = smsLogId;
	}
	
	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Index(name="idx_ra_smsinfo_mobile")
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Integer getEnableTryCount() {
		return enableTryCount;
	}

	public void setEnableTryCount(Integer enableTryCount) {
		this.enableTryCount = enableTryCount;
	}
	

	public Integer getSmsLogId() {
		return smsLogId;
	}

	public void setSmsLogId(Integer smsLogId) {
		this.smsLogId = smsLogId;
	}
}
